export function formate(time, fmt) {
  let Time = parseInt(time)
  let date = new Date(Time)
  if(/(Y+)/.test(fmt)) {
    fmt = fmt.replace(RegExp.$1, date.getFullYear() + '').substr(4-RegExp.$1)
  }
  let regObj = {
    'M+': date.getMonth() + 1,
    'D+': date.getDate(),
    'h+': date.getHours(),
    'm+': date.getMinutes()
  }
  for (let k in regObj) {
    if(new RegExp(`(${k})`).test(fmt)) {
      let str = regObj[k] + ''
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1)?str:strTwo(str))
    }
  }
  return fmt
}
function strTwo(str) {
  return ('00' + str).substr(str.length);
}